package com.pojo;

import java.util.List;

public class Page<T> {
    public static final Integer PAGE_SIZE = 4;
    //当前页码
    private Integer pageNo;
    //总页数
    private Integer pageTotal;
    //总记录数
    private Integer pageTotalcount;
    //当前页面数据
    private List<T> items;
    //页面显示数量
    private Integer pageSize;

    private String url;
    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        if(pageNo<1){
            this.pageNo=1;
            return;
        }
        if(pageTotal!=null&&pageNo>pageTotal){
            this.pageNo=pageTotal;
            return;
        }
        this.pageNo = pageNo;
    }

    public Integer getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(Integer pageTotal) {
        if(pageNo!=null&&pageNo<1){
            this.pageNo=1;
            return;
        }
        if(pageTotal!=null&&pageNo>pageTotal){
            this.pageNo=pageTotal;
            return;
        }
        this.pageTotal = pageTotal;
    }

    public Integer getPageTotalcount() {
        return pageTotalcount;
    }

    public void setPageTotalcount(Integer pageTotalcount) {
        this.pageTotalcount = pageTotalcount;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
    @Override
    public String toString() {
        return "Page{" +
                "pageNo='" + pageNo + '\'' +
                ", getPageTotal=" + pageTotal +
                ", pageTotalcount=" + pageTotalcount +
                ", items=" + items +
                ", pageSize=" + pageSize +
                '}';
    }
}
